<template>
	<view>
		<cu-custom bgColor="bg-gradual-purple" :isBack="true"><block slot="backText">返回</block>
			<block slot="content">添加任务</block>
		</cu-custom>	
		
			<view class="bg-white" >
			
				<view class="padding-xl margin-bottom" >
					<input  placeholder="请输入任务名称" name="actName" data-tag="actName" v-model="actName" />
				</view>
				<button class="action margin-lg  bg-yellow " @tap="saveActName">确定</button>
		</view>
	</view>
</template>

<script>
	export default {
		name:"newAct",
		data() {
			return {
				name:'',
				modalName:'',
				myactlist: [],
				StatusBar: this.StatusBar,
				CustomBar: this.CustomBar,
				actName:'',
				mypoolList: [],
				actModal:'',
				nickName:'',
			}
		},
		created() {
			let str = uni.getStorageSync("mypoolList");
			this.mypoolList = JSON.parse(str);
		},
		methods: {
			newAct(){
				let nickName = uni.getStorageSync("nickName");
				if(nickName){
					// this.modalName = "actModal";
					uni.navigateTo({
						url:'../plugin/newAct'
					})
				}
			},
			saveActName(){
				if(!this.actName ||	this.actName.trim()===''){
					return;
				}
				if(this.mypoolList.indexOf(this.actName)===-1){
					this.mypoolList.push(this.actName)
					uni.setStorageSync('mypoolList',JSON.stringify(this.mypoolList))
				}
				uni.navigateBack({
					delta:1
				})
				// uni.navigateTo({
				// 	url:'../index/index',
				// })
			},
			
				
			removeMe(e){
				console.log(e.currentTarget.dataset.tag)
				let index = this.mypoolList.indexOf(e.currentTarget.dataset.tag)
				this.mypoolList.splice(index,1)
				uni.setStorageSync('mypoolList',JSON.stringify(this.mypoolList))
			},
			hideModal(e) {
				this.modalName = null
			},
			showModal(e) {
				let nickName = uni.getStorageSync("nickName")
				if(!nickName)
				{
					return;
				}
				uni.navigateTo({
					url: '/pages/plugin/pull?name='+e.currentTarget.dataset.tag
					+"&nickName="+nickName,
				});
				// console.log('showModal',e.currentTarget)
				// this.modalName = e.currentTarget.dataset.target
				// this.name = e.currentTarget.dataset.tag
			},
			PickerChange(e){
					this.actid = e.detail.value
			},
		}
	}
</script>

<style>

</style>
